home *** CD-ROM | disk | FTP | other *** search
/ Mac Format 1995 June / MacFormat 25.iso / Shareware City / Developers / OutOfPhase1.1 Source / OutOfPhase Folder / AlgoSampObject.h < prev    next >
Text File  |  1994-06-05  |  7KB  |  166 lines

  1. /* AlgoSampObject.h */
  2.  
  3. #ifndef Included_AlgoSampObject_h
  4. #define Included_AlgoSampObject_h
  5.  
  6. /* AlgoSampObject module depends on */
  7. /* MiscInfo.h */
  8. /* Audit */
  9. /* Debug */
  10. /* Definitions */
  11. /* AlgoSampList */
  12. /* Memory */
  13. /* DataMunging */
  14. /* CodeCenter */
  15. /* PcodeStack */
  16. /* PcodeSystem */
  17. /* MainWindowStuff */
  18. /* Alert */
  19. /* Numbers */
  20. /* SampleStorageActual */
  21. /* AlgoSampWindow */
  22. /* SampleConsts */
  23. /* CompilerRoot */
  24. /* FunctionCode */
  25. /* BufferedFileInput */
  26. /* BufferedFileOutput */
  27.  
  28. #include "SampleConsts.h"
  29. #include "MainWindowStuff.h"
  30.  
  31. struct AlgoSampObjectRec;
  32. typedef struct AlgoSampObjectRec AlgoSampObjectRec;
  33.  
  34. /* forward declarations */
  35. struct CodeCenterRec;
  36. struct MainWindowRec;
  37. struct AlgoSampListRec;
  38. struct BufferedFileInput;
  39. struct BufferedFileOutput;
  40.  
  41. /* allocate and create a new empty algorithmic sample object, with reasonable defaults */
  42. AlgoSampObjectRec*        NewAlgoSampObject(struct CodeCenterRec* CodeCenter,
  43.                                                 struct MainWindowRec* MainWindow,
  44.                                                 struct AlgoSampListRec* AlgoSampList);
  45.  
  46. /* dispose of an algorithmic sample object */
  47. void                                    DisposeAlgoSampObject(AlgoSampObjectRec* AlgoSampObj);
  48.  
  49. /* find out if algorithmic sample object has been modified */
  50. MyBoolean                            HasAlgoSampObjectBeenModified(AlgoSampObjectRec* AlgoSampObj);
  51.  
  52. /* build the algorithmic sample.  returns True if successful. */
  53. MyBoolean                            AlgoSampObjectBuild(AlgoSampObjectRec* AlgoSampObj);
  54.  
  55. /* unconditionally unbuild the algorithmic sample */
  56. void                                    AlgoSampObjectUnbuild(AlgoSampObjectRec* AlgoSampObj);
  57.  
  58. /* build the algorithmic sample if necessary.  return True if successful. */
  59. MyBoolean                            AlgoSampObjectMakeUpToDate(AlgoSampObjectRec* AlgoSampObj);
  60.  
  61. /* get a copy of the algorithmic sample's name. */
  62. char*                                    AlgoSampObjectGetNameCopy(AlgoSampObjectRec* AlgoSampObj);
  63.  
  64. /* set the algorithmic sample's name.  the object becomes the owner of the Name */
  65. /* block so the caller should not release it. */
  66. void                                    AlgoSampObjectNewName(AlgoSampObjectRec* AlgoSampObj, char* Name);
  67.  
  68. /* get a copy of the formula that generates the algorithmic sample */
  69. char*                                    AlgoSampObjectGetFormulaCopy(AlgoSampObjectRec* AlgoSampObj);
  70.  
  71. /* install a new formula into the algorithmic sample.  the object becomes the owner */
  72. /* of the formula, so the caller should not release it */
  73. void                                    AlgoSampObjectNewFormula(AlgoSampObjectRec* AlgoSampObj,
  74.                                                 char* Formula);
  75.  
  76. /* get the number of bits in a channel for the algorithmic sample */
  77. NumBitsType                        AlgoSampObjectGetNumBits(AlgoSampObjectRec* AlgoSampObj);
  78.  
  79. /* change the number of bits in a channel for the algorithmic sample */
  80. void                                    AlgoSampObjectPutNumBits(AlgoSampObjectRec* AlgoSampObj,
  81.                                                 NumBitsType NewNumBits);
  82.  
  83. /* get the number of channels in the algorithmic sample */
  84. NumChannelsType                AlgoSampObjectGetNumChannels(AlgoSampObjectRec* AlgoSampObj);
  85.  
  86. /* change the number of channels for the algorithmic sample */
  87. void                                    AlgoSampObjectPutNumChannels(AlgoSampObjectRec* AlgoSampObj,
  88.                                                 NumChannelsType NewNumChannels);
  89.  
  90. /* get the number of data frames in the algorithmic sample */
  91. long                                    AlgoSampObjetGetNumFrames(AlgoSampObjectRec* AlgoSampObj);
  92.  
  93. /* get the loop control values.  if the loop end and loop start are the same, */
  94. /* then there is no loop.  Note that these values are NOT bounds checked in any */
  95. /* way so it is the callers responsibility to deal with nonsensical values. */
  96. long                                    AlgoSampObjectGetOrigin(AlgoSampObjectRec* AlgoSampObj);
  97. long                                    AlgoSampObjectGetLoopStart1(AlgoSampObjectRec* AlgoSampObj);
  98. long                                    AlgoSampObjectGetLoopStart2(AlgoSampObjectRec* AlgoSampObj);
  99. long                                    AlgoSampObjectGetLoopStart3(AlgoSampObjectRec* AlgoSampObj);
  100. long                                    AlgoSampObjectGetLoopEnd1(AlgoSampObjectRec* AlgoSampObj);
  101. long                                    AlgoSampObjectGetLoopEnd2(AlgoSampObjectRec* AlgoSampObj);
  102. long                                    AlgoSampObjectGetLoopEnd3(AlgoSampObjectRec* AlgoSampObj);
  103.  
  104. /* get algorithmic sample attributes */
  105. long                                    AlgoSampObjectGetSamplingRate(AlgoSampObjectRec* AlgoSampObj);
  106. double                                AlgoSampObjectGetNaturalFrequency(AlgoSampObjectRec* AlgoSampObj);
  107.  
  108. /* get a pointer to the raw data for the sample.  this pointer is the */
  109. /* actual data, not a copy, so don't dispose of it.  if any operations are performed */
  110. /* on the sample, this pointer may become invalid.  format of raw data: */
  111. /*  - mono, 8-bit:  array of signed bytes */
  112. /*  - stereo, 8-bit:  array of signed bytes, grouped in pairs.  the one lower in */
  113. /*    memory is the left channel */
  114. /*  - mono, 16-bit:  array of signed short integers (either 2 or 4 bytes) */
  115. /*  - stereo, 16-bit:  array of signed short integers, grouped in pairs.  the one */
  116. /*    lower in memory is the left channel */
  117. /* if it returns NIL, then the thing couldn't be built */
  118. char*                                    AlgoSampObjectGetRawData(AlgoSampObjectRec* AlgoSampObj);
  119.  
  120. /* change the loop control values and attributes */
  121. void                                    AlgoSampObjectPutOrigin(AlgoSampObjectRec* AlgoSampObj,
  122.                                                 long Origin);
  123. void                                    AlgoSampObjectPutLoopStart1(AlgoSampObjectRec* AlgoSampObj,
  124.                                                 long LoopStart);
  125. void                                    AlgoSampObjectPutLoopStart2(AlgoSampObjectRec* AlgoSampObj,
  126.                                                 long LoopStart);
  127. void                                    AlgoSampObjectPutLoopStart3(AlgoSampObjectRec* AlgoSampObj,
  128.                                                 long LoopStart);
  129. void                                    AlgoSampObjectPutLoopEnd1(AlgoSampObjectRec* AlgoSampObj,
  130.                                                 long LoopEnd);
  131. void                                    AlgoSampObjectPutLoopEnd2(AlgoSampObjectRec* AlgoSampObj,
  132.                                                 long LoopEnd);
  133. void                                    AlgoSampObjectPutLoopEnd3(AlgoSampObjectRec* AlgoSampObj,
  134.                                                 long LoopEnd);
  135. void                                    AlgoSampObjectPutSamplingRate(AlgoSampObjectRec* AlgoSampObj,
  136.                                                 long SamplingRate);
  137. void                                    AlgoSampObjectPutNaturalFrequency(AlgoSampObjectRec* AlgoSampObj,
  138.                                                 double NaturalFrequency);
  139.  
  140. /* call which makes object open its editor window */
  141. MyBoolean                            AlgoSampObjectOpenWindow(AlgoSampObjectRec* AlgoSampObj);
  142.  
  143. /* this is called by the window when it is closing to notify the object. */
  144. /* the object should not take any action. */
  145. void                                    AlgoSampObjectClosingWindowNotify(AlgoSampObjectRec* AlgoSampObj,
  146.                                                 short NewX, short NewY, short NewWidth, short NewHeight);
  147.  
  148. /* the document's name has changed, so the windows need to be updated */
  149. void                                    AlgoSampObjectGlobalNameChange(AlgoSampObjectRec* AlgoSampObj,
  150.                                                 char* NewFilename);
  151.  
  152. /* read from the file and create a new algorithmic sample object from it. */
  153. FileLoadingErrors            AlgoSampObjectNewFromFile(AlgoSampObjectRec** ObjectOut,
  154.                                                 struct BufferedInputRec* Input, struct CodeCenterRec* CodeCenter,
  155.                                                 struct MainWindowRec* MainWindow,
  156.                                                 struct AlgoSampListRec* AlgoSampList);
  157.  
  158. /* write the object out to the specified file. */
  159. FileLoadingErrors            AlgoSampObjectWriteOutData(AlgoSampObjectRec* AlgoSampObj,
  160.                                                 struct BufferedOutputRec* Output);
  161.  
  162. /* mark the object as saved */
  163. void                                    AlgoSampObjectMarkAsSaved(AlgoSampObjectRec* AlgoSampObj);
  164.  
  165. #endif
  166.